CLS

Syntax: CLS [#chan,] [cls_type]
Location: QL ROM

This command is normally used to clear all or part of the specified window (default #1) to the current paper colour for that channel (this is not affected by OVER).  CLS does not affect a BORDER attached to a window.

The cls_type can be used to specify which area of the window is to be cleared (the default is 0). This can have the following standard values, which have different effects depending upon the current position of the text cursor:

0 clear the whole window
1 clear the window above the cursor line
2 clear the window below the cursor line
3 clear the whole cursor line
4 clear the window from the cursor position to the right-hand
  end of the cursor line

After using this command, the text cursor is placed at the top left-hand corner of the window (if cls_type=0) or at the start of the next line below the cursor position for other values.

Except under SMS and on the THOR XVI, most systems allow you to use other values for cls_type to access various TRAP #3 system utilities. The way in which the appropriate value of cls_type is calculated is by taking the value of D0 which would be used in machine code and subtracting 32 from this. If this gives a negative result, then add this negative result to 128.

NOTE:
Some of the additional values of cls_type can actually cause the computer to crash.

CROSS-REFERENCE:
AT and PRINT position the text cursor.
PAPER alters the current paper colour.
SCROLL and PAN also allow you to access various system utilities. 
A much safer way to access system utilities is to use IO_TRAP, MTRAP, QTRAP and BTRAP.
